﻿using DataStructure.Interview;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace DataStructure.Test
{
    
    
    /// <summary>
    ///This is a test class for Question3Test and is intended
    ///to contain all Question3Test Unit Tests
    ///</summary>
    [TestClass()]
    public class Question3Test
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for RemoveDuplicated
        ///</summary>
        [TestMethod()]
        public void EmptyTest()
        {
            char[] str = {  }; // TODO: Initialize to an appropriate value
            char[] expected = {  }; // TODO: Initialize to an appropriate value
            char[] actual;
            actual = Question3.RemoveDuplicated(str);
            CollectionAssert.AreEquivalent(expected, actual);
        }

        /// <summary>
        ///A test for RemoveDuplicated
        ///</summary>
        [TestMethod()]
        public void ShorTest()
        {
            char[] str = { 'a'}; // TODO: Initialize to an appropriate value
            char[] expected = { 'a'}; // TODO: Initialize to an appropriate value
            char[] actual;
            actual = Question3.RemoveDuplicated(str);
            CollectionAssert.AreEquivalent(expected, actual);
        }

        /// <summary>
        ///A test for RemoveDuplicated
        ///</summary>
        [TestMethod()]
        public void NoDuplicatedTest()
        {
            char[] str = {'a', 'b', 'c','d', 'e'}; // TODO: Initialize to an appropriate value
            char[] expected = { 'a', 'b', 'c', 'd', 'e' }; // TODO: Initialize to an appropriate value
            char[] actual;
            actual = Question3.RemoveDuplicated(str);
            CollectionAssert.AreEquivalent(expected, actual);
        }

        [TestMethod()]
        public void NormalDuplicatedTest()
        {
            char[] str = { 'a', 'b', 'a', 'b', 'e' }; // TODO: Initialize to an appropriate value
            char[] expected = { 'a', 'b' ,'e'}; // TODO: Initialize to an appropriate value
            char[] actual;
            actual = Question3.RemoveDuplicated(str);
            CollectionAssert.AreEquivalent(expected, actual);
        }

        [TestMethod()]
        public void AllDuplicatedTest()
        {
            char[] str = { 'a', 'a', 'a', 'a', 'a' }; // TODO: Initialize to an appropriate value
            char[] expected = { 'a' }; // TODO: Initialize to an appropriate value
            char[] actual;
            actual = Question3.RemoveDuplicated(str);
            CollectionAssert.AreEquivalent(expected, actual);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentNullException))]
        public void NullArgTest()
        {
            char[] str = null; // TODO: Initialize to an appropriate value
            char[] expected = { 'a' }; // TODO: Initialize to an appropriate value
            char[] actual;
            actual = Question3.RemoveDuplicated(str);
        }

        [TestMethod()]
        public void ContinualTest()
        {
            char[] str = { 'a', 'a', 'b', 'b', 'b' }; // TODO: Initialize to an appropriate value
            char[] expected = { 'a', 'b' }; // TODO: Initialize to an appropriate value
            char[] actual;
            actual = Question3.RemoveDuplicated(str);
            CollectionAssert.AreEquivalent(expected, actual);
        }
    }
}
